// written by entire team

#include "HTMLOutputter.h";
#include "Event.h"
#include "Appt.h"
#include "XMLParser.h"
#include "Filter.h"
#include "DayTime.h"
#include "DayParser.h"
#include <iostream>
#include <cctype>
#include "EventProcessor.h"
#include <sstream>
#include <cstdio>

#include "Comparator.h"

const string f = "-f";
const string empty = "";
const string space = " ";

int main(int argc, char* argv[]){
	int whichEvent = 1;
	
	//simple way of loading in multiple files
//	EventProcessor process;
//	for(int k=0; k< argc; k++)
//	{
//		cout<<"Reading file " << argv[k] << " ...";
//		XMLParser parser(argv[k]);
//		cout<<"done."<<endl;
//		
//		cout<<"Processing file " << argv[k] << " ...";
//		process.add(parser.getEvents());
//		cout<<"done." << endl;
//	}

	cout<<"Reading file...";
	XMLParser parser("source.xml", whichEvent);
	vector<Event*> events = parser.getEvents();
	cout<<"done."<<endl;
	/*some tests
	sort(testEvents.begin(), testEvents.end(), Comparitor<Event> (new Sorter<Event>()));
	for(unsigned int k = 0; k< testEvents.size()-1; k++)
	{
		Event a = testEvents.at(k);
		cout << a.getDay() << space << a.getDescription()<<endl;
		cout << " is same as next Event ";
		if(a==testEvents[k+1])
			cout << "true";
		else cout << "false";
		cout << endl;
	}
	*/
	cout<<"Processing...";
	EventProcessor process(events);
	cout<<"done." << endl;
	
	cout<<"Outputting...";
	cerr << "Outputting...";
	HTMLOutputter out;
	process.generateHTML(out);
	cerr << "done.";
	cout<<"done."<<endl;
	cout<<"Program completed."<<endl;
	
	return 0;
}
